﻿using System;

namespace Builder
{
    class Program
    {
        static void Main(string[] args)
        {
            if (args.Length != 1)
            {
                Usage();
                return;
            }

            if (args[0].Equals("plain"))
            {
                TextBuilder textbuilder = new TextBuilder();
                Director director = new Director(textbuilder);
                
                director.Construct();
                string result = textbuilder.GetResult();
                Console.WriteLine(result);
            }
            else if (args[0].Equals("html"))
            {
                HTMLBuilder htmlbuilder = new HTMLBuilder();
                Director director = new Director(htmlbuilder);

                director.Construct();
                string fileName = htmlbuilder.GetResult();
                Console.WriteLine(fileName + "が作成されました。");
            }
            else
            {
                Usage();
                return;
            }
        }

        public static void Usage()
        {
            Console.WriteLine("Usage: java Main plain.");
            Console.WriteLine("Usage: java Main html.");
        }
    }
}
